package com.coocaa.app.lib.cleaner.deleter.apk;

import android.content.Context;

import com.coocaa.app.lib.cleaner.deleter.AbstractDeleter;
import com.coocaa.app.lib.cleaner.deleter.apk.impl.ApkDeleterImpl;

import java.util.List;

/**
 * Created by lu on 17-4-13.
 */

public abstract class ApkDeleterFactory {
    /**
     * Created by lu on 17-4-13.
     */

    public interface ApkDeleter extends AbstractDeleter {
        interface ApkDeleterListener {
            /**
             * @param isMutils
             * @param apk
             */
            void onApkDeleterStart(boolean isMutils, List<String> apk);

            /**
             * @param isMutils
             * @param apk
             * @param result
             * @param size
             */
            void onApkDeleterEnd(boolean isMutils, List<String> apk, boolean result, long size);
        }

        void delete(Context context, List<String> apks, ApkDeleterListener listener);

        void delete(Context context, String apk, ApkDeleterListener listener);
    }

    public static final ApkDeleterFactory factory = new ApkDeleterFactory() {
        private ApkDeleter deleter = null;

        @Override
        public ApkDeleter create() {
            return new ApkDeleterImpl();
        }

        @Override
        public synchronized ApkDeleter instance() {
            if (deleter == null)
                deleter = create();
            return deleter;
        }
    };

    public abstract ApkDeleter create();

    public abstract ApkDeleter instance();
}
